package com.shanghaionstar.navi.search.history;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.shanghaionstar.R;

import java.util.List;

/**
 * Created by zhaoyang on 2017/7/21.
 */

public class NavSearchHistoryAdapter extends RecyclerView.Adapter<NavSearchHistoryAdapter.NavSearchHistoryVH>{

    private Context mContext;
    private List<String> mData;

    public NavSearchHistoryAdapter(Context context, List<String> list){
        mContext = context;
        mData = list;
    }

    @Override
    public NavSearchHistoryVH onCreateViewHolder(ViewGroup parent, int viewType) {
        View inflate = LayoutInflater.from(mContext).inflate(R.layout.item_search_history, null);
        return new NavSearchHistoryVH(inflate);
    }

    @Override
    public void onBindViewHolder(NavSearchHistoryVH holder, int position) {
        holder.itemName.setText(mData.get(position));
    }

    @Override
    public int getItemCount() {
        return 5;
    }

    public class NavSearchHistoryVH extends RecyclerView.ViewHolder{

        private TextView itemName;
        private TextView itemSendToCar;

        public NavSearchHistoryVH(View itemView) {
            super(itemView);

            itemName = (TextView) itemView.findViewById(R.id.history_item_name);
            itemSendToCar = (TextView) itemView.findViewById(R.id.history_item_send_to_car);
        }
    }
}
